<%--
  @author Kusal Samarakoon
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>


<script type="text/javascript">

    /*$(function() {

    $('select#province').bind('change', function(evt1) {
        var id = $("select#province").attr("value");
        //alert("PR:"+id);
        $.getJSON('${pageContext.request.contextPath}/common/DivisionLookupService', {id:id,mode:1},
                 function(data) {
                     //alert("ale:");
                     var options1 = '<option value="0"> - Select All - </option> ';
                     var dis = data.districtsList;
                     //alert( dis.length);
                     for (var i = 0; i < dis.length; i++) {
                         options1 += '<option value="' + dis[i].optionValue + '">' + dis[i].optionDisplay + '</option>'

                     }
                     $("select#district").html(options1);
                 });

    });
});

$(function() {
    $('select#district').bind('change', function(evt1) {
        var id = $("select#district").attr("value");
        $.getJSON('${pageContext.request.contextPath}/common/DivisionLookupService', {id:id},
                 function(data) {
                     var options1 = '<option value="0"> - Select All - </option> ';
                     var ds = data.dsDivisionList;
                     for (var i = 0; i < ds.length; i++) {
                         options1 += '<option value="' + ds[i].optionValue + '">' + ds[i].optionDisplay + '</option>'
                     }
                     $("select#dsDivision").html(options1);
                 });

    });
});*/

    </script>


<table>
    <tr>
        <td colspan="2" class="left-align">
            <div class="action-msg"><s:actionmessage/></div>
            <div class="action-err"><s:actionerror/></div>
        </td>
    </tr>
</table>


<div id="local-authority-home-title" class="module-home-title">
    <s:a href="localAuthorityModule.do"><img src="${pageContext.request.contextPath}/images/user.png"
                                   alt="Manage local Authority"><span><s:label
            value="%{getText('localAuthorityModule.label')}"/></span></s:a>
</div>

<div id="add-local-authority-form" class="module-home">

    <s:if test="editMode==1">
        <h2><s:label value="%{getText('updateLocalAuthority.label')}"/></h2>
    </s:if>
    <s:else>
        <h2><s:label value="%{getText('addLocalAuthority.label')}"/></h2>
    </s:else>
    <hr/>

    <s:form id="local-authority-form" name="local-authority-form" method="POST"
            onsubmit="javascript:return validateFormForInputDataSyntaxErrors('local-authority-form')" >
        <table>
            <tr>
                <td colspan="2" class="left-align">
                    <div class="action-msg"><s:actionmessage/></div>
                    <div class="action-err"><s:actionerror/></div>
                </td>
            </tr>




            <%--<tr id="provinceId">
                <td class="left-align"><s:label value="%{getText('province.label')}"/></td>
                <td><s:select list="provinceList" name="province"
                              id="province" headerKey="0" headerValue="%{getText('select.label')}"/></td>
            </tr>

            <tr id="districtId">
                <td class="left-align"><s:label value="%{getText('district.label')}"/></td>
                <td><s:select list="districtList" name="district"
                              id="district" headerKey="0" headerValue="%{getText('select.label')}"/></td>
            </tr>
            <tr id="dsDivisionId">
                <td class="left-align"><s:label value="%{getText('ds_division.label')}"/></td>

                <td><s:select name="localAuthority.dsDivision.id" id="dsDivision" headerKey="0" headerValue="%{getText('select.label')}"
                              list="dsDivisionList" cssClass="width-180-px"/>
                </td>
            </tr>--%>

            <tr>
            <td><s:label value="%{getText('district.label')}"/></td>
            <td><s:textfield id="districtId" name="districtName" cssClass="width-200-px" disabled="true"/></td>
        </tr>
        <tr>
            <td><s:label value="%{getText('ds_division.label')}"/></td>
            <td><s:textfield id="dsDivisionId" name="dsName" cssClass="width-200-px" disabled="true"/></td>
        </tr>

            <tr id="localAuthorityTypeId">

                <s:if test="editMode==1">
                       <td class="left-align"><s:label value="%{getText('localAuthorityType.label')}"/></td>

                <td><s:select list="localAuthorityTypeList" name="localAuthority.localAuthorityType.id"
                              id="localAuthorityTypeId" headerKey="0" headerValue="%{getText('select.label')}" disabled="true" /></td>
                    <s:hidden name="localAuthority.localAuthorityType.id"/>
                </s:if>
                <s:else>
                       <td class="left-align"><s:label value="%{getText('localAuthorityType.label')}"/></td>

                <td><s:select list="localAuthorityTypeList" name="localAuthority.localAuthorityType.id"
                              id="localAuthorityTypeId" headerKey="0" headerValue="%{getText('select.label')}" /></td>
                </s:else>

            </tr>

            <tr>
                <td class="left-align"><s:label value="%{getText('localAuthorityNameSinhala.label')}" /></td>
                <td class="right-align"><s:textfield name="localAuthority.siName" id="localAuthorityNameSinhala"/></td>
            </tr>

            <tr>
                <td class="left-align"><s:label value="%{getText('localAuthorityNameTamil.label')}" /></td>
                <td class="right-align"><s:textfield name="localAuthority.taName" id="localAuthorityNameTamil"/></td>
            </tr>

            <tr>
                <td class="left-align"><s:label value="%{getText('localAuthorityNameEnglish.label')}" /></td>
                <td class="right-align"><s:textfield name="localAuthority.enName" id="localAuthorityNameEnglish"/></td>
            </tr>

            <s:if test="editMode==1">


                <tr>
                    <td colspan="2" class="right-align"><s:submit value="%{getText('update.label')}"
                                                                  action="updateLocalAuthority"/></td>
                </tr>
            </s:if>
            <s:else>
                <tr>
                    <td colspan="2" class="right-align"><s:submit value="%{getText('save.label')}"
                                                                  action="saveLocalAuthority"/></td>
                </tr>
            </s:else>
        </table>
        <s:hidden name="localAuthority.id"/>

    </s:form>


</div>

<%--<s:hidden id="edit_mode" name="editMode"/>--%>
